package com.maybach.core.ao;

import com.maybach.core.form.flow.FlowActForm;
import com.maybach.core.form.flow.TaskActForm;
import com.maybach.util.query.support.PageResult;
import com.maybach.workflow.common.ext.FlowTaskInfo;
import com.maybach.workflow.common.model.FlowApplyDO;
import com.maybach.workflow.common.query.FlowApplyIndexQuery;
import com.maybach.workflow.common.query.FlowApplyQuery;

import java.util.List;

/**
 * Created by houenxun on 16/1/13.
 */
public interface FlowApplyAO {
    /**
     * 创建申请
     * @param apply
     * @return
     */
    Long createApply(FlowApplyDO apply);

    /**
     * 修改后重新 提交申请
     * @param apply
     * @return
     */
    void updateApply(FlowApplyDO apply);

    /**
     * 重新申请流程
     * @param applyDO
     * @param taskId
     * @return
     */
    Long reApplyFlow(FlowApplyDO applyDO, Long taskId);

    /**
     * 分页查询流程申请
     * @param query
     * @param list
     * @return
     */
    PageResult<FlowApplyDO> queryFlowApply(FlowApplyQuery query, List<FlowApplyIndexQuery> list );

    /**
     *
     * @param applyId
     * @return
     */
    List<FlowTaskInfo> getTasksByApplyId(Long applyId, boolean filter);

    List<FlowTaskInfo> getTasksByApplyId(FlowApplyDO applyDO, boolean filter);

    /**
     * 执行任务
     * @param taskActForm
     */
    void executeTask(TaskActForm taskActForm);

    /**
     * 操作流程
     * @param flowActForm
     */
    void operaterFlow(FlowActForm flowActForm);

    /**
     * 根据taskId查询申请信息
     * @param taskId
     * @return
     */
    FlowApplyDO getApplyByTaskId(Long taskId);

}
